﻿using System;
using System.Reflection;
using System.Windows;

namespace MVBuddy.Common.Model
{
    public class TileData
    {
        public UserData UserData { get; set; }
        public double Scale { get; private set; }

        public TileData()
        {
            this.UserData = new UserData();
            this.Scale = 0.824;

            if (Environment.OSVersion.Version >= new Version(7, 10, 8858))
            {
                this.Scale = 1.0;

                Type hostType = typeof(System.Windows.Interop.Content);
                PropertyInfo scaleFactorProperty = hostType.GetProperty("ScaleFactor");
                if (scaleFactorProperty != null)
                {
                    int scaleValue = (int)scaleFactorProperty.GetValue(Application.Current.Host.Content, null);
                    this.Scale = scaleValue / 100.0;
                }
            }
        }
    }
}
